package com.example.zhangguoqing.homeofpet.utils;

import com.example.zhangguoqing.homeofpet.model.DataDao;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class JsonUtil {
    public static List<DataDao> parseArrayJsonWithGson(String jsonData){
        Gson gson=new Gson();
        List<DataDao> userList=gson.fromJson(jsonData,new TypeToken<List<DataDao>>(){}.getType());
        for(Iterator<DataDao> iterator=userList.iterator();iterator.hasNext();){
            DataDao dataDao=(DataDao) iterator.next();
            System.out.println("guangzhao--->"+dataDao.getGuangzhao());
            System.out.println("turang--->"+dataDao.getKongqi());
        }
        return userList;

    }
}
